//引入 mongoose模块
const mongoose = require("mongoose");
// 链接mongo数据库系统， 选择___数据库
mongoose.connect("mongodb://127.0.0.1:27017/sh2104", {
    useNewUrlParser: true,
    useUnifiedTopology: true
});

// 监听状态
mongoose.connection.on("connected", () => {
    console.log("链接成功");
});
mongoose.connection.on("disconnected", () => {
    console.log("链接断开");
});
mongoose.connection.on("error", () => {
    console.log("链接失败");
});

// 暴露mongoos对象
module.exports = mongoose;